/*
 * @Author: ZechariahZheng
 * @Date: 2022-02-24 16:46:03
 * @LastEditors: ZechariahZheng
 * @LastEditTime: 2022-05-09 09:52:37
 * @Description: 記錄各個tab的值
 */
const state = ({      //state里面存放的是变量，如果你要注册全局变量，写这里
    docIssuseIndex: 0,
    docReciveIndex: 0,
    shenPiIndex: 0,
    notifyIndex: 0,
    noticeTitle: "",
    noticeSummary: "",
    noticeType: "",
    noticeRange: "",
    noticeInput: "",
    noticeAttachments: [],
    selectedGroups: [],
    tmpSelectedPerson: [],
    emailIndex: 0,
    selectUserBackUrl: "",
    selectPersonType: true,      //true为主送人，false为抄送人
    selectedMainPerson: [],
    selectedMainGroup: [],
    tmpSelectedMainPerson: [],
    selectedAppendPerson: [],
    selectedAppendGroup: [],
    tmpSelectedAppendPerson: [],
    emailContent: "",
    emailRawContent: "",
    emailTopic: "",
    emailAttachments: [],
    zhuanyueIndex: 0,
    distributeIndex: 0,
});

const getters = {                //getters相当于是state的计算属性，如果你需要将变量的值进行计算，然后输出，写这里
    getDocIssuseIndex(state) {
        return state.docIssuseIndex;
    },
    getDocReciveIndex(state) {
        return state.docReciveIndex;
    },
    getShenPiIndex(state) {
        return state.shenPiIndex;
    },
    getNotifyIndex(state) {
        return state.notifyIndex;
    },
    getNoticeTitle(state) {
        return state.noticeTitle;
    },
    getNoticeSummary(state) {
      return state.noticeSummary;
  },
    getNoticeType(state) {
        return state.noticeType;
    },
    getNoticeRange(state) {
        return state.noticeRange;
    },
    getNoticeInput(state) {
        return state.noticeInput;
    },
    getSelectedGroups(state) {
        return state.selectedGroups;
    },
    getTmpSelectedPerson(state) {
        return state.tmpSelectedPerson;
    },
    getEmailIndex(state) {
        return state.emailIndex;
    },
    getSelectUserBackUrl(state) {
        return state.selectUserBackUrl;
    },
    getSelectPersonType(state) {
        return state.selectPersonType;
    },
    getSelectedMainPerson(state) {
        return state.selectedMainPerson;
    },
    getSelectedMainGroup(state) {
        return state.selectedMainGroup;
    },
    getTmpSelectedMainPerson(state) {
        return state.tmpSelectedMainPerson;
    },
    getSelectedAppendPerson(state) {
        return state.selectedAppendPerson;
    },
    getSelectedAppendGroup(state) {
        return state.selectedAppendGroup;
    },
    getTmpSelectedAppendPerson(state) {
        return state.tmpSelectedAppendPerson;
    },
    getZhuanyueIndex(state) {
      return state.zhuanyueIndex;
    },
    getDistributeIndex(state) {
      return state.distributeIndex;
    },
    getEmailContent(state) {
        return state.emailContent;
    },
    getEmailAttachments(state) {
        return state.emailAttachments;
    },
    getEmailRawContent(state) {
        return state.emailRawContent;
    },
    getEmailTopic(state) {
        return state.emailTopic;
    },
    getNoticeAttachments(state) {
        return state.emailAttachments;
    },
};

const mutations = {       //修改store中的变量的方法，如果你要改变变量的值，就写这里
    SET_docIssuseIndex(state, value) {
        state.docIssuseIndex = value;
    },
    SET_docReciveIndex(state, value) {
        state.docReciveIndex = value;
    },
    SET_shenPiIndex(state, value) {
        state.shenPiIndex = value;
    },
    SET_notifyIndex(state, value) {
        state.notifyIndex = value;
    },
    SET_noticeTitle(state, value) {
        state.noticeTitle = value;
    },
    SET_noticeSummary(state, value) {
      state.noticeSummary = value;
  },
    SET_noticeType(state, value) {
        state.noticeType = value;
    },
    SET_noticeRange(state, value) {
        state.noticeRange = value;
    },
    SET_noticeInput(state, value) {
        state.noticeInput = value;
    },
    SET_selectedGroups(state, value) {
        state.selectedGroups = value;
    },
    SET_tmpSelectedPerson(state, value) {
        state.tmpSelectedPerson = value;
    },
    SET_emailIndex(state, value) {
        state.emailIndex = value;
    },
    SET_selectUserBackUrl(state, value) {
        state.selectUserBackUrl = value;
    },
    SET_selectPersonType(state, value) {
        state.selectPersonType = value;
    },
    SET_selectedMainPerson(state, value) {
        state.selectedMainPerson = value;
    },
    SET_selectedMainGroup(state, value) {
        state.selectedMainGroup = value;
    },
    SET_tmpSelectedMainPerson(state, value) {
        state.tmpSelectedMainPerson = value;
    },
    SET_selectedAppendPerson(state, value) {
        state.selectedAppendPerson = value;
    },
    SET_selectedAppendGroup(state, value) {
        state.selectedAppendGroup = value;
    },
    SET_tmpSelectedAppendPerson(state, value) {
        state.tmpSelectedAppendPerson = value;
    },
    SET_zhuanyueIndex(state, value) {
      state.zhuanyueIndex = value;
    },
    SET_distributeIndex(state, value) {
      state.distributeIndex = value;
    },
    SET_emailContent(state, value) {
        state.emailContent = value;
    },
    SET_emailAttachments(state, value) {
        state.emailAttachments = value;
    },
    SET_emailRawContent(state, value) {
        state.emailRawContent = value;
    },
    SET_emailTopic(state, value) {
        state.emailTopic = value;
    },
    SET_noticeAttachments(state, value) {
        state.noticeAttachments = value;
    },
};

const actions = {            //actions提交的是mutations，相当于就是改变变量的方法的重写，但是，actions是可以进行异步操作的
    setDocIssuseIndex(content, value) {
        content.commit('SET_docIssuseIndex', value);
    },
    setDocReciveIndex(content, value) {
        content.commit('SET_docReciveIndex', value);
    },
    setShenPiIndex(content, value) {
        content.commit('SET_shenPiIndex', value);
    },
    setNotifyIndex(content, value) {
        content.commit('SET_notifyIndex', value);
    },
    setNoticeTitle(content, value) {
        content.commit('SET_noticeTitle', value);
    },
    setNoticeType(content, value) {
        content.commit('SET_noticeType', value);
    },
    setNoticeRange(content, value) {
        content.commit('SET_noticeRange', value);
    },
    setNoticeInput(content, value) {
        content.commit('SET_noticeInput', value);
    },
    setSelectedGroups(content, value) {
        content.commit('SET_selectedGroups', value);
    },
    setTmpSelectedPerson(content, value) {
        content.commit('SET_tmpSelectedPerson', value);
    },
    setEmailIndex(content, value) {
        content.commit('SET_emailIndex', value);
    },
    setSelectUserBackUrl(content, value) {
        content.commit('SET_selectUserBackUrl',value);
    },
    setSelectPersonType(content, value) {
        content.commit('SET_selectPersonType', value);
    },
    setSelectedMainPerson(content, value) {
        content.commit('SET_selectedMainPerson', value);
    },
    setSelectedMainGroup(content, value) {
        content.commit('SET_selectedMainGroup', value);
    },
    setTmpSelectedMainPerson(content, value) {
        content.commit('SET_tmpSelectedMainPerson', value);
    },
    setSelectedAppendPerson(content, value) {
        content.commit('SET_selectedAppendPerson', value);
    },
    setSelectedAppendGroup(content, value) {
        content.commit('SET_selectedAppendGroup', value);
    },
    setTmpSelectedMainPerson(content, value) {
        content.commit('SET_tmpSelectedMainPerson', value);
    },
    setZhuanyueIndex(content, value) {
      content.commit('SET_zhuanyueIndex', value);
    },
    setDistributeIndex(content, value) {
      content.commit('SET_distributeIndex', value);
    },
    setEmailContent(content, value) {
        content.commit('SET_emailContent', value);
    },
    setEmailAttachments(content, value) {
        content.commit('SET_emailAttachments', value);
    },
    setEmailRawContent(content, value) {
        content.commit('SET_emailRawContent', value);
    },
    setEmailTopic(content, value) {
        content.commit('SET_emailTopic', value);
    },
    setNoticeAttachments(content, value) {
        content.commit('SET_noticeAttachments', value);
    }
};


export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
};
